#include<reg52.h>
#define SMG P0
sbit La = P2^2;
sbit Lb = P2^3;
sbit Lc = P2^4;
void delay_tenus(unsigned int time)
{
	while(time--);
}

void main()
{
	char smg_code[] = {0x3f,0x06,0x5b,0x4f,0x66,0x6d,0x7d,0x07};
	int sz = sizeof(smg_code) / sizeof(smg_code[0]);
	while(1)
	{
		int i = 0;
		for(i = 0; i < sz;  i++)
		{
			switch(i)
			{
				case 0:	La = 1; Lb = 1; Lc = 1; break;
				case 1:	La = 0; Lb = 1; Lc = 1; break;
				case 2:	La = 1; Lb = 0; Lc = 1; break;
				case 3:	La = 0; Lb = 0; Lc = 1; break;
				case 4:	La = 1; Lb = 1; Lc = 0; break;
				case 5:	La = 0; Lb = 1; Lc = 0; break;
				case 6:	La = 1; Lb = 0; Lc = 0; break;
				case 7:	La = 0; Lb = 0; Lc = 0; break;
			}
			SMG = smg_code[i];
			delay_tenus(50);
		}
	}
}